gdkwindow: Clean up code
authorJasper St. Pierre <jstpierre@mecheye.net>
Sat, 21 Jun 2014 14:16:14 +0000 (10:16 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Sat, 21 Jun 2014 14:17:23 +0000 (10:17 -0400)
Introduce a temporary to make the code a bit more clear under these cases.

gdk/gdkwindow.c

index 1a3966b70ef5f412ee17fddc050bccf5538b24c6..dd217136e698688c05f157c3d2527614f2bbdd6a 100644 (file)
@@ -2818,6 +2818,7 @@ gdk_window_end_paint (GdkWindow *window)
   if (window->current_paint.surface_needs_composite)
     {
       cairo_surface_t *surface;
+      gboolean skip_alpha_blending;
 
       cairo_region_get_extents (window->current_paint.region, &clip_box);
       full_clip = cairo_region_copy (window->clip_region);
@@ -2831,8 +2832,12 @@ gdk_window_end_paint (GdkWindow *window)
       gdk_cairo_region (cr, full_clip);
       cairo_clip (cr);
 
-      if (gdk_window_has_impl (window) ||
-          window->alpha == 255)
+      /* We can skip alpha blending for a fast composite case
+       * if we have an impl window or we're a fully opaque window. */
+      skip_alpha_blending = (gdk_window_has_impl (window) ||
+                             window->alpha == 255);
+
+      if (skip_alpha_blending)
         {
           cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
           cairo_paint (cr);